import request from '@/utils/request'
import { makeFormData } from '@/utils/util'

const api = {
  roleTypes: 'web/staff/area_roles', // 园区角色列表
  positionList: 'web/area/get_platfrom_position_list', // 园区职位
  nurseryClassTypes: 'web/course_topic/target_object_list', // 托班类型
  teachAreas: 'web/teaching_area/page_by_area', // 教学区域
  teachAreaInfo: 'web/teaching_area/detail',
  teachAreaModify: 'web/teaching_area/modify',
  teachAreaAdd: 'web/teaching_area/create',
  doctorsByArea: 'web/doctor/all_by_area',
  teachersByArea: 'web/teacher/all_by_area',
  staffByArea: '/web/staff/area_staff',
  classesByArea: 'web/classes/list_by_area',
  noClassesByArea: 'web/children/list_non_classes',
  noticeNum: 'web/red_point/get_red_point_info', // 获取通知红点数
  noticeList: 'web/notice/getNoticeList', // 获取通知列表
  addNotice: 'web/notice/addNotice', // 添加通知
  childrenList: 'web/children/page', // 宝宝列表
  childrenDetail: 'web/children/detail', // 获取宝宝信息
  createChild: 'v2/child/add', // 添加宝宝
  nurseryClasses: 'web/nursery_schedule/classes_list', // 获取托班班级
  upload: 'system/upload', // 上传
  childrenListByClasses: 'web/classes/children', // 通过班级id查询宝宝列表

  documentDir: 'api/document_dir' ,// 文档目录

  adminSensitivity:'tuoApi/tuoApi/babysDay/adminSensitivity',
}

export function getRoleTypes (params = {}, method = 'get') {
  return request({
    url: api.roleTypes,
    method,
    params
  })
}

export function getNoticeNum (params = {}) {
  return request({
    url: api.noticeNum,
    method: 'get',
    params
  })
}

export function getNurseryClassTypes (params = {}) {
  return request({
    url: api.nurseryClassTypes,
    method: 'post',
    params
  })
}

export function getTeachAreas (params = {}, data = {}) {
  return request({
    url: api.teachAreas,
    method: 'post',
    params,
    data: makeFormData(data)
  })
}

export function getTeachAreaInfo (data = {}) {
  return request({
    url: api.teachAreaInfo,
    method: 'post',
    data: makeFormData(data)
  })
}

export function teachAreaSubmit (params, data = {}) {
  return request({
    url: data.teachingAreaId ? api.teachAreaModify : api.teachAreaAdd,
    method: 'post',
    params,
    data: makeFormData(data)
  })
}

export function getDoctorsByArea (params = {}) {
  return request({
    url: api.doctorsByArea,
    method: 'post',
    params
  })
}

export function getTeachersByArea (params = {}) {
  return request({
    url: api.staffByArea,
    method: 'post',
    params: {
      // roleId: '2d6d11b374e6459ab8d8c9efb7773135',
      ...params
    }
  })
}

export function getClassesByArea (params = {}) {
  console.log(params)
  return request({
    url: api.classesByArea,
    method: 'post',
    params
  })
}

export function getNoClassesByArea (params = {}) {
  return request({
    url: api.noClassesByArea,
    method: 'post',
    params
  })
}

export function getNoticeList (params = {}, data = {}) {
  return request({
    url: api.noticeList,
    method: 'post',
    params,
    data: makeFormData(data)
  })
}

export function addNotice (data = {}) {
  return request({
    url: api.addNotice,
    method: 'post',
    data: makeFormData(data)
  })
}

export function getChildrenList (params = {}, data = {}) {
  return request({
    url: api.childrenList,
    method: 'post',
    params,
    data: makeFormData(data)
  })
}

export function getChildrenListByClasses (params = {}) {
  return request({
    url: api.childrenListByClasses,
    method: 'get',
    params
  })
}

export function getChildrenDetail (params = {}) {
  return request({
    url: api.childrenDetail,
    method: 'post',
    params
  })
}

export function createChild (data = {}) {
  return request({
    url: api.createChild,
    method: 'post',
    data: makeFormData(data)
  })
}

export function getNurseryClasses (params = {}) {
  return request({
    url: api.nurseryClasses,
    method: 'post',
    params
  })
}

export function delDocumentDir (params = {}) {
  return request({
    url: api.documentDir,
    method: 'delete',
    params
  })
}

export function dirSubmit (params = {}, method = 'post') {
  return request({
    url: api.documentDir,
    method,
    params
  })
}
export function ssoCodeVerify (params = {}) {
  return request({
    url: api.adminSensitivity,
    method: 'get',
    params
  })
}
